<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<title>Amici</title>
</head>
<body>
<%
   session.setAttribute("id", request.getAttribute("id"));
%>
<p>
   <a href="ProfiloAmmServlet?id=<%= request.getAttribute("id") %>"><%= request.getAttribute("id") %></a>
   <a href="RicercaAmm.jsp">Ricerca</a>
   <a href="LogoutServlet?username=<%= request.getAttribute("id")%>&user=amministratore">Logout</a>
</p>
<% 
    int size = Integer.parseInt(request.getAttribute("size").toString()); 

    if(size == 0) {
    	
    	out.println("L'utente non ha amici");
    	
    }
    else {
    	
    	for(int i = 0; i < size; i++) {
    		
    	   String username = request.getAttribute("el" + i).toString();
 		   String id = request.getAttribute("id").toString();
 		   out.println("<a href=\"ProfiloUtenteDaAmmServlet?username=" + username + "&id=" + id + "\">");
   	       out.println(username);
   	       out.println("</a>");
   	       out.println("<br/>");
    		
    	}
    	
    }

%>
</body>
</html>